package com.xjgc.common.constant;

import java.beans.PropertyDescriptor;
import java.util.HashMap;
import java.util.Map;

import org.apache.commons.beanutils.PropertyUtils;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

public class Consants {
    /**
     * 表对应工艺编号关系
     * SCHJWSD  生产环境温湿度 400001
     * BKJC 板卡检测表	400002
     * 装置组装	400003
     * 绝缘耐压	400004
     * 老化测试	400005
     * 装置检测	400006
     * 屏柜与SN号关联表	400007
     * 生产Bom	400008
     * 板卡库存	400009
     * 生产工艺路线	400010
     * 出厂检测	400011
     * 系统联调	400012
     * 原材料-继电器	400013
     * 原材料-互感器	400014
     * 原材料-电源模块	400015
     * 波峰焊温度表	400016
     * 波峰焊时间表	400017
     * 追溯温度表	400018
     * 追溯时间表	400019
     * 回流焊温度表	400020
     * 回流焊时间表	400021
     */
    public static final String SCHJWSD = "400001";
    public static final String BKJC = "400002";
    public static final String ZZZZ = "400003";
    public static final String JYNY = "400004";
    public static final String LHCS = "400005";
    public static final String ZZJC = "400006";
    public static final String PGYSN = "400007";
    public static final String SCBOM = "400008";
    public static final String BKKC = "400009";
    public static final String SCGYLX = "400010";
    public static final String CCJC = "400011";
    public static final String XTLD = "400012";
    public static final String JDQ = "400013";
    public static final String HGQ = "400014";
    public static final String DYMK = "400015";
    public static final String BFHWDB = "400016";
    public static final String BFHSJB = "400017";
    public static final String ZSWDB = "400018";
    public static final String ZSSJB = "400019";
    public static final String HLHWDB = "400020";
    public static final String HLHSJB = "400021";

    /**
     * 装置检测审批
     */
    public static final String ZZJC_SP = "2";
    /**
     * 出厂检测审批
     */
    public static final String CCJC_SP = "3";
    /**
     * 系统联调审批
     */
    public static final String XTLD_SP = "4";

    /**
     * 工序类型
     * 1-装置组装
     * 2-绝缘耐压
     * 3-老化测试
     * 4-装置检测
     */
    public static final String PROCESS_TYPE1 = "1";
    public static final String PROCESS_TYPE2 = "1";
    public static final String PROCESS_TYPE3 = "1";
    public static final String PROCESS_TYPE4 = "1";

    /**
     * 审核状态
     * 0-未审核
     * 1-装置检测已审核
     * 2-出厂检测已审核
     * 3-系统联调已审核
     */
    public static final String REVIEW_STATUS0 = "0";
    public static final String REVIEW_STATUS1 = "1";
    public static final String REVIEW_STATUS2 = "2";
    public static final String REVIEW_STATUS3 = "3";

    /**
     * 审核状态
     * read 已读
     * Unread 未读

     */
    public static final String read = "0";
    public static final String Unread = "1";


    public static Map<String, String> beValue(QueryWrapper<?> queryWrapper, Object searchObj, Map<String, String[]> parameterMap) {
        PropertyDescriptor origDescriptors[] = PropertyUtils.getPropertyDescriptors(searchObj);
        String name, type;
        String endValue = null,beginValue = null;
        for (int i = 0; i < origDescriptors.length; i++) {
            name = origDescriptors[i].getName();
                if (parameterMap != null && parameterMap.containsKey(name + "_begin")) {
                    beginValue = parameterMap.get(name + "_begin")[0].trim();
                }
            if (parameterMap != null && parameterMap.containsKey(name + "_end")) {
                endValue = parameterMap.get(name + "_end")[0].trim();
            }
        }
        Map<String, String> map = new HashMap<>();
        map.put("beginValue",beginValue);
        map.put("endValue",endValue);
        return map;
    }

}
